package com.feonix.common.view.tip;

import org.apache.commons.lang.StringUtils;
import org.springframework.web.servlet.tags.RequestContextAwareTag;

import com.feonix.common.util.StringUtil;


public class TipTag extends RequestContextAwareTag {

	/**
	 * 
	 */
	private static final long serialVersionUID = -1012939069709178894L;
	
	
	private String src;
	private String title;

	protected int doStartTagInternal() throws Exception {
		StringBuffer sb = new StringBuffer();

		sb.append("<i class=\"iconfont help\" title=\"");

		String str = (String) this.pageContext.getRequest().getAttribute(this.title);
		if (StringUtils.isBlank(str)) {
			str = this.title;
		}
		sb.append(str);

		sb.append("\">&#xf503b;</i>");
		try {
			this.pageContext.getOut().write(String.valueOf(sb.toString()));
			StringUtil.cleanStringBuffer(new StringBuffer[]{sb});
		} catch (Exception exception) {
			this.logger.error("模板输出失败", exception);
		}
		return 1;
	}

	public String getTitle() {
		return this.title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getSrc() {
		return this.src;
	}

	public void setSrc(String src) {
		this.src = src;
	}

}
